package io.dy.mq.consumer;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author dmj
 * @date 2024年04月18日 下午4:55
 */
@Component
public class TopicConsumer {

    @RabbitListener(queues = {"dy.topic.queue01"})
    public void listen01(String msg){
        System.out.println("消费者(dy.topic.queue01 # dy.item):" + msg);
    }

    @RabbitListener(queues = {"dy.topic.queue02"})
    public void listen02(String msg){
        System.out.println("消费者(dy.topic.queue02 # dy.sku):" + msg);
    }

    @RabbitListener(queues = {"dy.topic.queue03"})
    public void listen03(String msg){
        List<String> list = new ArrayList<>();
        System.out.println(list.get(1));
        System.out.println("消费者(dy.topic.queue03 # dy.*):" + msg);
    }

    @RabbitListener(queues = {"dy.topic.queue04"})
    public void listen04(String msg){
        System.out.println("消费者(dy.topic.queue04 # *.item):" + msg);
    }
}
